<template>
  <dev>
    <!--审核弹框-->
    <el-dialog title="管理员备注" width="50%" :visible.sync="dialogVisibleAdmin" :close-on-click-modal="false">
      <el-form :model="adminDataForm" label-width="100%" :size="size"
               label-position="right" inline>
        <el-form-item>
          <div style="width:100%;">
            <el-input
              type="textarea"
              placeholder="请输入备注"
              v-model="adminDataForm.auditRemark">
              :rows="4"
            </el-input>
          </div>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer" style="text-align:center">
        <el-button :size="size" @click.native="submitFormAdminNotPass" type="primary">不通过</el-button>
        <el-button :size="size" type="primary" @click.native="submitFormAdmin">通过</el-button>
      </div>
    </el-dialog>

    <span v-show="status == auditStatus">
        <div style="margin-top:20px;" v-if="shenhe == 0">
          <el-button type="primary" @click="shenheHuodong(1)">审核</el-button>
        </div>
    </span>
    <span v-show="status == notAuditStatus">
      <div style="margin-top:20px;" v-if="shenhe == 0">
        <el-button type="primary" plain :size="size" @click="shenheHuodong(0)">提交审核</el-button>
      </div>
      <div style="margin-top:20px;" v-if="shenhe == 1">
        <el-button type="primary" plain :size="size" @click="shenheHuodong(1)">审核</el-button>
      </div>
    </span>
  </dev>
</template>

<script>
  import KtButton from "@/views/Core/KtButton";
  import {format} from "@/utils/datetime";
  import TableColumnFilterDialog from "@/views/Core/TableColumnFilterDialog";
  import {darkmagenta} from "color-name";
  import {quillEditor} from "vue-quill-editor";
  import "quill/dist/quill.core.css";
  import "quill/dist/quill.snow.css";
  import "quill/dist/quill.bubble.css";

  const channelArr = ["bbc"];
  const channelArr1 = ["APP端", "PC端", "微信"];
  const channelArr2 = ["新用户", "老用户"];
  const channelArr3 = ["普通会员"];
  const channelArr4 = ["注册用户", "VIP会员", "金卡"];
  import {
    singleFrontPromTypesRadio,
    chanelCodesRadio,
    proPlatformRadio,
    proUserTypeRadio,
    proMemberTypeRadio,
    proMemberLevelRadio
  } from "@/market/dict/marketDict";

  export default {
    name: "Audit",
    components: {
      KtButton,
      TableColumnFilterDialog,
      quillEditor
    },
    props: {
      status: {
        type: Number,
        default: 0
      },
      auditStatus: {
        type: Number,
        default: 0
      },
      notAuditStatus: {
        type: Number,
        default: 0
      },
    },
    data() {
      return {
        size: "small",
        // 审核-start
        adminDataForm: {
          auditRemark: ""
        },
        dialogVisibleAdmin: false,
        shenhe: 0
        // 审核-end

      }
    },
    methods: {
      submitFormAdminNotPass() {
        this.shenhe = 2;
        this.dialogVisibleAdmin = false;

        let callback = res => {
          console.log(res);
        };
        this.adminDataForm.id = this.promotionId;
        this.adminDataForm.status = 4;
        this.utils.request.promotionUpdate(this.adminDataForm, callback);
        this.shenhe = 0;
      },
      submitFormAdmin() {
        this.shenhe = 2;
        this.dialogVisibleAdmin = false;

        let callback = res => {
          console.log(res);
        };
        this.adminDataForm.id = this.promotionId;
        this.adminDataForm.status = 3;
        this.utils.request.promotionUpdate(this.adminDataForm, callback);
      },
      shenheHuodong(flag) {
        if (flag == 0) {
          this.$confirm("是否确认提交审核？", "提示", {
            type: "warning"
          })
            .then(() => {
              this.shenhe = 1;

              let callback = res => {
                console.log(res);
              };
              let param = {};
              param.id = this.promotionId;
              param.status = 2;

              this.utils.request.promotionUpdate(param, callback);

            })
            .catch(() => {
            });
        } else {
          this.dialogVisibleAdmin = true;
        }
      }
    },
    created: function () {

    },
    mounted: function () {
      console.log(status + '-jjj');
    }
  }

</script>


<style lang="scss" scoped>
  @import '../../../../assets/css/public.scss';
</style>
